<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    ul,li{
      margin:0;
      padding:0;
      list-style: none;
    }
    ul{
      display: flex;
      flex-wrap:wrap;
      justify-content: flex-start;
      margin-left:20px;
    }
    li{
      width: 30%;
    }
  </style>
</head>
<body>
  <div id="app">
    <ul>
      <li v-for="(film,index) in films" :key="film.filmId">
        <h3>{{ film.name }}</h3>
        <p>
          导演：{{film.director}}
        </p>
        <img :src="film.poster" alt="">
      </li>
    </ul>
  </div>
  <script src="./vue.js"></script>
  <script src="./axios.js"></script>
  <script>
    const vm = new Vue({
      el: '#app',
      data: {
        films: []
      },
      created () {
        this.fetchFilmData();
      },
      methods: {
        fetchFilmData () {
          // 定义一个请求函数
          axios.get('https://m.maizuo.com/gateway?cityId=440300&pageNum=1&pageSize=10&type=1&k=9532407',{
            headers:{
              "X-Client-Info": '{"a":"3000","ch":"1002","v":"5.0.4","e":"160256909153244709568514"}',
              "X-Host": "mall.film-ticket.film.list"
            }
          }).then(res=>{
            console.log(res)
            if( res.data.status === 0 ){
              this.films = res.data.data.films
            }
          })
        }
      }
    })
  </script>
</body>
</html>